/**
 * index页面的一些api
 */
import request from '@/config/axios'

export const getData = () =>
  request.get({ url: '/api/onlyforone/hardware/list' })

export const getDetail = (id) =>
  request.get({ url: `/api/onlyforone/hardware/detail/${id}` })
export const pageGood = (queryWrapper) => {
  let realQeryWrapper = {}
  realQeryWrapper.level_one_category_id = queryWrapper.level_one_category_id
  realQeryWrapper.level_two_category_id = queryWrapper.level_two_category_id
  realQeryWrapper.level_three_category_id = queryWrapper.level_three_category_id
 
  if (queryWrapper.pageSize) {
    realQeryWrapper.page_size = queryWrapper.pageSize
  }
  if (queryWrapper.pageNumber) {
    realQeryWrapper.page = queryWrapper.pageNumber
  }

  if (queryWrapper.keyword) {
    realQeryWrapper.keyword = queryWrapper.keyword
  }
  // debugger

  Object.keys(realQeryWrapper).forEach((key) => {
    if (realQeryWrapper[key] == undefined) {
      delete realQeryWrapper[key]
    }
  })

  return request.get({
    url: `/api/onlyforone/good/v1/search`,
    params: realQeryWrapper
  })
}